<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * @author Garry
 * @desc A simple display class
 *
 */
class PageDisplay extends Display {

	/**
	 * 
	 * Load in final view...
	 */
	public function finalize(){
		$this->addLinks( 'styles' );
		$this->addLinks( 'scripts' );
		$this->assembleJSInit();
		if( !empty($this->output->pagecontent) ){
			$this->__set('content', get_instance()->load->view($this->output->pagecontent,$this->output,true));
		}
		get_instance()->load->view('base',$this->output);
	}
	
	protected function assembleJSInit( ){
		$buffer = "";
		foreach (Display::$initialisedJavaScript as $line ){
			$buffer = $buffer."\r $line";
		}
		$this->__set("js_init_script", $buffer);
	}
	
	protected function addLinks( $links ){
		$this->__set( $links."output", Display::$$links );
	}
}


?>